package org.arclib.math;

/**
 * 
 * @author Clay Smith
 * 
 */
public class Size
{
	public double w, h;

	public final static Size Zero = new Size(0, 0);
	public final static Size d800x600 = new Size(800, 600);
	public final static Size d1024x768 = new Size(1024, 768);
	public final static Size d640x480 = new Size(640, 480);

	/**
	 * 
	 * @param argW
	 *            Width
	 * @param argH
	 *            Height
	 */
	public Size(double argW, double argH)
	{
		w = argW;
		h = argH;
	}

	// / returns largest component
	public double maxComponent()
	{
		if (w > h)
			return w;
		return h;
	}

	// / returns smallest component
	public double minComponent()
	{
		if (w < h)
			return w;
		return h;
	}

	/**
	 * 
	 * @return w Width
	 */
	public double getW()
	{
		return w;
	}

	/**
	 * 
	 * @return h Height
	 */
	public double getH()
	{
		return h;
	}

	public double halfW()
	{
		return w / 2;
	}

	public double halfH()
	{
		return h / 2;
	}

	public void set(double width, double height)
	{
		// TODO Auto-generated method stub
		w = width;
		h = height;

	}

	public Point div(double i)
	{
		// TODO Auto-generated method stub
		return new Point(w/i, h/i); 
	}

	public Size sub(Size argSize)
	{
		// TODO Auto-generated method stub
		return new Size(w - argSize.w, h - argSize.h); 
	}
}
